<%@page import="java.util.Map"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.grom.po.Security"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html style="height:100%;width:100%;">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Log in</title>
<script src="http://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
<link href="http://cdn.bootcss.com/bootstrap/3.1.1/css/bootstrap.css" rel="stylesheet">
<script src="http://cdn.bootcss.com/bootstrap/3.1.1/js/bootstrap.js"></script>
<style type="text/css">

</style>
<script type="text/javascript">
			    
</script>
</head>
<body>

<nav class="navbar navbar-default" role="navigation">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
               <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
               <span class="sr-only">Toggle navigation</span>
               <span class="icon-bar"></span>
               <span class="icon-bar"></span>
               <span class="icon-bar"></span>
               </button>
               <a class="navbar-brand" href="#"><img src="<%=request.getContextPath() %>/css/logo.jpg"></a>
            </div>
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
               <ul class="nav navbar-nav">
				<%
					List<Security> rootModules = (List<Security>)request.getAttribute("rootModules");
					if(rootModules==null){
						rootModules = new ArrayList<Security>();
					}
					for(Security security : rootModules){
						%>
						<li><a href="<%=request.getContextPath() %>/FrameAction/changeDepart.do?SYSID=<%=security.getActionUrl() %>"><%=security.getSecurityName() %></a></li>
						<%
					}
				%>
					<% 
						String SYSID = (String)request.getAttribute("SYSID"); 
						if(SYSID.equals("SALE")&&(rootModules==null||rootModules.size()==0)){
					%>
						<li><a href="<%=request.getContextPath() %>/FrameAction/changeDepart.do?SYSID=SALE"/>销售管理</a></li>
					<%
						}
					%>
				</ul>
               <ul class="nav navbar-nav navbar-right">
                  <li><a href="<%=request.getContextPath() %>/LoginAction/logOut.do">退出</a></li>
               </ul>
            </div>
            <!-- /.navbar-collapse -->
</nav>

<div class="container" style="margin:0;padding:0; width:100%;height:99%">
	<div class="row">
	  <div class="col-md-3">
		
		<div class="panel-group" id="accordion">
		
		<%
			String openStr = "in";
	    	Map<Security, List<Security>> userSecuritys = (Map<Security, List<Security>>)request.getAttribute("userSecuritys");
	    	for(Security parent : userSecuritys.keySet()){
	    %>
	    	<div class="panel panel-default">
		    <div class="panel-heading">
		      <h4 class="panel-title">
		        <a data-toggle="collapse" data-toggle="collapse" data-parent="#accordion" href="#<%=parent.getID() %>">
		          <%=parent.getSecurityName() %>
		        </a>
		      </h4>
		    </div>
		    <div id="<%=parent.getID() %>" class="panel-collapse collapse <%=openStr%> ">
		      <div class="panel-body">
	    		<% 
	    			openStr = "";
	    			List<Security> children = userSecuritys.get(parent);
	    			for(Security child : children){
	    		%>
	    			<p><a onclick="$('#main').attr('src','<%=request.getContextPath() %><%=child.getActionUrl() %>')" href="#"><%=child.getSecurityName() %></a></p>
	    			
	    		<%
	    			}
	    		%>
		      </div>
		    </div>
		  </div>
	    <%
	    	}
	    %>
		
		  <div class="panel panel-default">
		    <div class="panel-heading">
		      <h4 class="panel-title">
		        <a data-toggle="collapse" data-toggle="collapse" data-parent="#accordion" href="#collapseThree">
		          SysInfo
		        </a>
		      </h4>
		    </div>
		    <div id="collapseThree" class="panel-collapse collapse">
		      <div class="panel-body">
		        Made by Grom!
		      </div>
		    </div>
		  </div>
		</div>
	  </div>
	  <div class="col-md-9" style="height:100%">
	  	<iframe name="main" src="<%=request.getContextPath() %>/welcome.html" id="main" frameBorder="0" style="border: none;" width="100%" height="100%"></iframe>
	  </div>
	</div>
</div>




</body>
</html>